﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CMN.Entity;
using CMN.Common;
using CMN.Framework;
using CMN.BLL;
namespace CMN.UI
{
    /// <summary>
    /// 模板类型（电脑版，移动版）
    /// </summary>
    public enum TemplateType
    {
        /// <summary>
        /// 电脑
        /// </summary>
        Computer = 1,
        /// <summary>
        /// 手机
        /// </summary>
        Phone = 2

    }
   public enum PageType
    {
        /// <summary>
        /// 首页
        /// </summary>
        IndexPage = 0,
        /// <summary>
        /// 封面页
        /// </summary>
        ChannelsPage = 1,
        /// <summary>
        /// 列表页
        /// </summary>
        ChannelPage = 2,
        /// <summary>
        /// 详细内容页
        /// </summary>
        ContentPage = 3,
        /// <summary>
        /// 搜索页面
        /// </summary>
        SearchPage = 4,
        /// <summary>
        /// 其他页面
        /// </summary>
        OtherPage = 5

    }

    /// <summary>
    /// 模板解析帮助类
    /// </summary>
    public class PageHelperEntity
    {



        private int pageIndex = 1;
        private List<Normal_ChannelEntity> _Navigator = new List<Normal_ChannelEntity>();

        /// <summary>
        /// 导航链接
        /// </summary>
        public List<Normal_ChannelEntity> Navigator { get { return _Navigator; } set { _Navigator = value; } }

        public string Title { get; set; }

        public string Keywords { get; set; }
        public string EncodeKeywords { get; set; }
        public string Description { get; set; }
        /// <summary>
        /// 当前页地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 模板类型  0 主页，1封面，2列表，3详细信息，4其他
        /// </summary>
        public PageType Type { get; set; }
        public string FromUrl { get; set; }
        /// <summary>
        /// 模板类型为其他的名称
        /// </summary>
        public string OtherTypeName { get; set; }
        /// <summary>
        /// 顶级栏目
        /// </summary>
        public int ChannelId { get; set; }

        private Normal_ChannelEntity _Channel = new Normal_ChannelEntity();
        /// <summary>
        /// 当前栏目信息
        /// </summary>
        public Normal_ChannelEntity Channel
        {
            get
            { return this._Channel; }
            set
            {
                this._Channel = value;
            }
        }
        private TemplateType tType = TemplateType.Computer;
        /// <summary>
        /// 模板类型（电脑，手机);
        /// </summary>
        public TemplateType TType
        {
            get { return tType; }
            set { this.tType = value; }
        }
        /// <summary>
        /// 需要传递的值
        /// </summary>
        public Object OtherEntity;

        public Normal_ChannelEntity _ParentChannel=new Normal_ChannelEntity();
        /// <summary>
        /// 所属频道
        /// </summary>
        public Normal_ChannelEntity ParentChannel
        {
            get { return this._ParentChannel; }
            set { this._ParentChannel = value; }
        }

        public int _ParentChannelId = 0;


        public string ParentDir { get; set; }

        /// <summary>
        /// 所属根栏目Id
        /// </summary>
        public int ParentChannelId
        {
            get
            {
                if (Channel == null) _ParentChannelId = 0; 
                else if (_ParentChannelId != 0) 
                    return _ParentChannelId; 
                else if (Channel.ReId == 0) 
                    _ParentChannelId = Channel.Id; 
                else _ParentChannelId = Channel.ReId; 
            return _ParentChannelId;
            }
            set{_ParentChannelId=value;}
        }
        /// <summary>
        /// 详细内容id
        /// </summary>
        public int ContentId { get; set; }

        /// <summary>
        /// 第几页
        /// </summary>
        public int PageIndex
        {
            get { return pageIndex; }
            set { this.pageIndex = value; }
        }
        /// <summary>
        /// 排序
        /// </summary>
        public string Order { get; set; }

        /// <summary>
        /// 搜索关键词
        /// </summary>
        public string SearchWords { get; set; }
    }

}
